{extends file='layout/admin.html'}

{block name='title'}特危险 CMS{/block}

{block name='content'}


<form action="admin/user_manage.html" method="get">
<input type="hidden" name="ids" />
<div class="clearfix sub_nav">
	<span class="btn fr"><a href="admin/user_manage/add">添加</a></span>
	<input type="text" class="input_text w290" name="q" value="{$smarty.get.q}" />
	<input type="submit" class="btn" value="Search" />
</div>
</form>
<form action="admin/user_manage/alldel" method="post">	
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="content_table">
	<thead>
		<tr style="height: 30px;">
			<th class="left" style="width: 5%;"></th>
			<th style="border-left: 1px solid #CCC; width: 20%; line-height: 30px;">用户名</th>
			<th style="border-left: 1px solid #CCC; width: 20%; line-height: 30px;">email</th>
			<th style="border-left: 1px solid #CCC; width: 25%; line-height: 30px;">用户类型</th>
			<th style="border-left: 1px solid #CCC; width: 15%; line-height: 30px;">
				<a href="{$smarty.const.SITE_URL}/admin/user_manage?t={if $smarty.get.t == 'DESC'}ASC{else}DESC{/if}">创建时间</a></th>
			<th class="right" style="border-left: 1px solid #CCC; width: 15%; line-height: 30px;" >操作</th>
		</tr>
	</thead>
	<tbody class="text_indent">
		{foreach $data as $val}
		{if $val@iteration % 2}<tr>{else}<tr class="odd" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #EEE; background-position: initial initial; background-repeat: initial initial; ">{/if}
			<td><input type="checkbox" name="ids[]" value="{$val.id}" /></td>	
			<td><a href="admin/user_manage/mod?id={$val.id}">{$val.name}</a></td>
			<td style="border-right-style: none; border-right-width: initial; border-right-color: initial;">{$val.email}</td>
			<td style="border-right-style: none; border-right-width: initial; border-right-color: initial;">
				{if $val.is_admin ==1}
				管理员
				{else}
				普通用户
				{/if}
				
			</td>
			<td style="border-right-style: none; border-right-width: initial; border-right-color: initial;">{date('Y-m-d', $val.add_time)}</td>
			<td style="border-right-style: none; border-right-width: initial; border-right-color: initial; text-align: center;">
				<a href="#">Select Actions <img src="images/i.gif" alt="Action menu" class="arrow" /></a>
				<div class="action_btn" style="display: none;">
					<ul class="action_menu">
						<li><a href="admin/user_manage/mod?id={$val.id}">编辑</a></li>
						<li><a href="admin/user_manage/delete?id={$val.id}" class="delete">删除</a></li>
					</ul>
				</div>
			</td>
		</tr>
		{/foreach}
		<tr align="left"><td colspan="6">
				<button>全选</button>
				<button>全不选</button>
				<button>反选</button>
				<button>删除</button>
				</td></tr>
	</tbody>
</table>
</form>
<div class="clearfix sub_nav">
{include file="lib/admin_pager.html"}
<span class="btn fr"><a href="admin/user_manage/add">添加</a></span>
</div>
<script type="text/javascript" charset="utf-8">

$('.arrow').each(function(){
  $(this).parent().popup($(this).parent().next());
});

$(".delete").click(function(){
		var url = this.href;
		confirm('你确定要删除吗?', function(){
	    location.href = url;
		});
		return false;
});
</script>

<script type="text/javascript" charset="utf-8">
	$("button:eq(0)").click(function(){
		$(":checkbox").attr("checked", true);
			return false;
		});
	
	$("button:eq(1)").click(function(){
		$(":checkbox").attr("checked", false);
		return false;
	});

	$("button:eq(2)").click(function(){
		var xu=$("input:checked");
		var nu=$("input:checkbox:not(:checked)");

		xu.attr("checked", false);
		nu.attr("checked", true);
		return false;
		});

	$("button:eq(3)").click(function(){

		this.form.submit();
		return false;
	});


	
</script>
{/block}
